<template>
  <div id="harvested">  

  <el-form ref="form"  label-width="80px">           
        
           <el-row>  
            <el-col :span="24"  style="display:flex;">
               <div style="height:38px;line-height:38px;width:150px;"> 
                  <i class="el-icon-back" @click="goBack"></i> 
                  {{ $route.query.name }} 
                </div>
                <el-form-item  label="" label-width="0px">
                        <el-select  v-model="form.select_num" placeholder="请选择种类" @change="select_change" style="width:200px;">
                            <el-option  v-for="(item,index) in form.selectdata" :key="index" :label="item.title" :value="item.maid"></el-option>
                        </el-select>
                </el-form-item> 
                 <el-form-item  label="" label-width="0px" style="margin-left:10px;">
                        <el-date-picker type="date" @change="data_change" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time" style="width:200px;"></el-date-picker>
                 </el-form-item>
            </el-col>    
        </el-row>

    </el-form>

   <!-- 渲染数据list -->
   <harvested-list :data="data" @up_list_fun="list_fun"> </harvested-list>

   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>

    

      
  </div>
</template>

<script>
import HarvestedList from '@/view/Consumer/HarvestedList'
export default {
  name: 'harvested',
  data () {
    return {
        data:[],
        page:1,
        count:0,
        my_uid:'',
        form:{
            select_num:'',
            selectdata:[],
            time:'',
        }
    }
  },
 components:{
    HarvestedList
  },
  created(){
      // this.form.time = this.getNowDate1()
      this.my_uid = this.$route.query.id
      this.list_zy()
      this.list_fun()
  },
  mounted (){
    
  },
  methods: {
    list_zy(){
      this.post("/manor/manorOption", {
       }).then(res => { 
           this.form.selectdata = res.result      
           this.form.selectdata.unshift({
                  maid:'',
                  title:'全部'
                })                    
    })
    },
    list_fun(){
         
         this.post("/member_goods/listOfData", {
                page:this.page,
                uid:this.my_uid,
                type:2,
                onetime:this.form.time,
                maid:this.form.select_num
            }).then(res => {
              this.count = res.result.count
              this.data = res.result.list
              
            
              console.log(res)
            })
       
          
      },
    select_change(){
          //console.log(this.form.select_num)
          this.page = 1
          this.list_fun()
    },
    data_change(){
        // console.log(this.form.time)
         this.page = 1
          this.list_fun()
    },
    goBack() {
        this.$router.go(-1)
    },
     handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
